package com.bkhc.business.entity;

import com.bkhc.common.annotation.Uid;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * 业务员
 */
@Entity
@Data
@Table(name = "tbl_business_group_member")
@EntityListeners(AuditingEntityListener.class)
public class Member {
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Id
    private Integer id ;

    @Column(name = "user_id")
    private String userId;

    @Column(name = "username")
    private String username;


    @Column(name = "full_name")
    private String fullName;

    @Column(name = "group_code")
    private String groupCode;

    @Column(name = "creator",updatable = false)
    private String creator;

    @Column(name = "create_date",updatable = false)
    @CreatedDate
    private Date createDate;

    @Column(name = "updator")
    private String updator;

    @LastModifiedDate
    @Column(name = "update_date")
    private Date updateDate;

    /**
     * 业务员可以查看的产品code 多个使用,隔开
     */
    @Column(name = "product_codes")
    private String productCodes;

    /**
     * 业务员可以查看的价格类型
     */
    @Column(name = "price_type")
    private String priceType;
    /**
     * 是否为业务合伙人（1是 0否）
     */
    @Column(name = "is_leader")
    private Integer isLeader;

    @Column(name = "invite_code")
    private String inviteCode;

    /**
     * 业务合伙人类型 （0个人 1企业）
     */
    @Column(name = "business_type")
    private Integer businessType;

    @Column(name="employment_date")
    private String employmentDate;

    @Column(name="mobile")
    private String mobile;


    public boolean isLeader(){
        return isLeader !=null && isLeader > 0;
    }
}
